package com.moment.eyepetizer.home.mvp

import com.moment.eyepetizer.net.CallBack
import com.moment.eyepetizer.net.GetDataList
import com.moment.eyepetizer.net.entity.Result
import io.reactivex.disposables.Disposable

/**
 * Created by moment on 2018/2/7.
 */

class CategoryPresenter(var categoryView: CategoryContract.CategoryView) : CategoryContract.CategoryPresenter {

    init {
        categoryView.setPresenter(this)
    }

    override fun start() = Unit

    override fun category(id: Int, start: Int, num: Int): Disposable =
            GetDataList.category(id, start, num, object : CallBack<Result> {
                override fun onCompleted() = Unit

                override fun onError(e: Throwable?) = categoryView.onCategoryFail(e)

                override fun onNext(t: Result) = categoryView.onCategorySucc(t)

            })

}